/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.basic.safe.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicSysDictEnum;
import com.hopes.boss.act.base.EnableFlowSearch;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 安全生产许可证
 *
 * @author pig
 * @date 2023-11-01 16:44:49
 */
@Data
@TableName("base_licence_production")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "安全生产许可证")
public class BaseLicenceProductionEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    @NotNull(message = "企业不能为空")
    @EnableFlowSearch()
    private Long orgId;

    /**
     * 许可证类型
     */
    @Schema(description = "许可证类型")
    @NotBlank(message = "许可证类型不能为空")
    @EnableFlowSearch()
    private String licenseType;

    /**
     * 许可证名称
     */
    @Schema(description = "许可证名称")
    @NotBlank(message = "许可证名称不能为空")
    @EnableFlowSearch(fuzzyQuery = true)
    private String licenseName;

    /**
     * 许可证编号
     */
    @Schema(description = "许可证编号")
    private String licenseCode;

    /**
     * 发证部门
     */
    @Schema(description = "发证部门")
    private String licensePublisher;

    /**
     * 许可范围
     */
    @Schema(description = "许可范围")
    private String licenseScope;

    /**
     * 有效日期
     */
    @Schema(description = "有效日期")
    @NotNull(message = "有效日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date effectiveDate;

    /**
     * 失效日期
     */
    @Schema(description = "失效日期")
    @NotNull(message = "失效日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date ineffectiveDate;

    /**
     * 许可证状态
     */
    @Schema(description = "许可证状态")
    private String licenseStatus;
    /**
     * 审核状态
     */
    @Schema(description = "审核状态")
    private String auditStatus;

    /**
     * 附件
     */
    @Schema(description = "附件")
    private String attachment;


    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.orgId);

    }

    public String getLicenseTypeStr() {

        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.license_type, this.licenseType);
    }

    public String getAuditStatusStr() {

        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.audit_status, this.auditStatus);
    }

}
